﻿import time, threading

class two_funcs():
    def __init__(self):
        self.intnum = 1
        
    def run1(self):
        for i in range(5):
            self.intnum += 1
            print '%d thread %s is running...<%d>\n' % (i, threading.current_thread().name, self.intnum)
    def run2(self):
        for i in range(5):
            self.intnum += 2
            print '%d thread %s is running...<%d>\n' % (i, threading.current_thread().name, self.intnum)
        
# def loop():
    # print 'thread %s is running...' % threading.current_thread().name
    # n = 0
    # while n < 5:
        # n = n + 1
        # print 'thread %s >>> %s' % (threading.current_thread().name, n)
        # time.sleep(1)
    # print 'thread %s ended.' % threading.current_thread().name

print 'thread %s is running...' % threading.current_thread().name
run_class = two_funcs()
t1 = threading.Thread(target=run_class.run1, name='run1')
t2 = threading.Thread(target=run_class.run2, name='run2')
t1.start()
t2.start()
t1.join()
t2.join()
print 'thread %s ended.' % threading.current_thread().name

